define(['app',
    'config'
], function(app,config) {
    app.registerProvider(
        'routeDefs',
        [
            '$stateProvider',
            '$urlRouterProvider',
            '$couchPotatoProvider',
            '$locationProvider',
            '$provide',
            function (
                $stateProvider,
                $urlRouterProvider,
                $couchPotatoProvider
                ) {

                this.$get = function() {
                    // this is a config-time-only provider
                    // in a future sample it will expose runtime information to the app
                    return {};
                };

                $urlRouterProvider
                    .when('', '/');

               $urlRouterProvider.otherwise('/');

               $stateProvider

                   //首页
                    .state('home', {
                        url: '/',
                        resolve: {
                            dummy: $couchPotatoProvider.resolveDependencies(['component/home/home.ctrl'])
                        },
                        views:{
                            'main': {
                                templateUrl: 'component/home/home.tpl.html',
                                controller: 'homeCtrl'
                            }
                        }
                    })


                   //新增套餐
                   .state('addPackage', {
                       url: '/addPackage/:packageId/:checkPackage',
                       resolve: {
                           dummy: $couchPotatoProvider.resolveDependencies(['package/package.editor.ctrl'])
                       },
                       views:{
                           'main': {
                               templateUrl: 'package/package.editor.tpl.html',
                               controller: 'PackageEditorCtrl'
                           }
                       }
                   })
                   .state('addPackage.force',{})

                    //权限设置
                   .state('permissions', {
                            url: '/permissions/:permission/:conditions',
                            resolve: {
                                dummy: $couchPotatoProvider.resolveDependencies(['setup/permissions/permissions.ctrl'])
                            },
                            views:{
                                'main': {
                                    templateUrl: 'setup/permissions/permissions.tpl.html',
                                    controller: 'permissionsCtrl'
                                }
                            }
                        })
                   .state('permissions.force',{})

                   //用户权限设置
                   .state('permissionPersonnel', {
                       url: '/permissionPersonnel',
                       resolve: {
                           dummy: $couchPotatoProvider.resolveDependencies(['setup/permissions/permissions.ctrl'])
                       },
                       views:{
                           'main': {
                               templateUrl: '../setup/permissions/permission.personnel.tpl.html',
                               controller: 'permissionsCtrl'
                           }
                       }
                   })
                   .state('permissionPersonnel.force',{})

                   //岗位权限设置
                   .state('jobPermissions', {
                       url: '/jobPermissions',
                       resolve: {
                           dummy: $couchPotatoProvider.resolveDependencies(['setup/permissions/permissions.ctrl'])
                       },
                       views:{
                           'main': {
                               templateUrl: 'setup/permissions/permissions.job.tpl.html',
                               controller: 'permissionsCtrl'
                           }
                       }
                   })
                   .state('jobPermissions.force',{})

                   //机构权限设置
                   .state('organizationPermissions', {
                       url: '/organizationPermissions',
                       resolve: {
                           dummy: $couchPotatoProvider.resolveDependencies(['setup/permissions/permissions.ctrl'])
                       },
                       views:{
                           'main': {
                               templateUrl: 'setup/permissions/permissions.organization.tpl.html',
                               controller: 'permissionsCtrl'
                           }
                       }
                   })
                   .state('organizationPermissions.force',{})
            }
        ]
    );
});